package com.wfs.springbootbeanregister;

import cn.itcast.pojo.Country;
import cn.itcast.pojo.Province;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Import;

@Import(com.wfs.config.CommonImportSeletor.class)//3 使用@Import导入ImportSelector
//@Import(com.wfs.config.CommonConfig.class)//2 导入配置类
@ComponentScan(basePackages = "com.wfs.config")//1 扫描指定包下的配置类
@SpringBootApplication
public class SpringbootBeanRegisterApplication {

    public static void main(String[] args) {
      ApplicationContext context =  SpringApplication.run(SpringbootBeanRegisterApplication.class, args);//获取ioc容器
      Country country = context.getBean(Country.class);//获取bean
      System.out.println(country);
      System.out.println(context.getBean("aa"));
    }
    /*@Bean
    public Country country(){
        return new Country();
    }*/
}
